﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MstartTemplate1.master" AutoEventWireup="true" CodeBehind="mywhishlist.aspx.cs" Inherits="WebSite1.mywhishlist" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" 
    DeleteCommand="DELETE FROM [wishlists] WHERE [wishlist_id] = @wishlist_id" 
    InsertCommand="INSERT INTO [wishlists] ([created], [wishlistname], [wishlist_cat_id]) VALUES (@created, @wishlistname, @wishlist_cat_id)" 
    ProviderName="<%$ ConnectionStrings:bestgifts4usConnectionString.ProviderName %>" 
    SelectCommand="SELECT wishlists.wishlist_id, wishlists.created, wishlists.wishlistname, wishlists.wishlist_cat_id, user_whishlist.user_id, user_whishlist.wishlist_id AS Expr1, wishlist_cat.cat_name FROM wishlists INNER JOIN user_whishlist ON wishlists.wishlist_id = user_whishlist.wishlist_id INNER JOIN wishlist_cat ON wishlists.wishlist_cat_id = wishlist_cat.cat_id WHERE (user_whishlist.user_id = @UserID)" 
    UpdateCommand="UPDATE [wishlists] SET [created] = @created, [wishlistname] = @wishlistname, [wishlist_cat_id] = @wishlist_cat_id WHERE [wishlist_id] = @wishlist_id">
    <DeleteParameters>
        <asp:Parameter Name="wishlist_id" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter DbType="Date" Name="created" />
        <asp:Parameter Name="wishlistname" Type="String" />
        <asp:Parameter Name="wishlist_cat_id" Type="Int32" />
    </InsertParameters>
    <SelectParameters>
        <asp:SessionParameter Name="UserID" SessionField="UserID" />
    </SelectParameters>
    <UpdateParameters>
        <asp:Parameter DbType="Date" Name="created" />
        <asp:Parameter Name="wishlistname" Type="String" />
        <asp:Parameter Name="wishlist_cat_id" Type="Int32" />
        <asp:Parameter Name="wishlist_id" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
         ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" 
        ProviderName="System.Data.SqlClient" 
        
        SelectCommand="SELECT wishlist_items.id, wishlist_items.wishlist_id, wishlist_items.item_id, items.title, items.price, items.url FROM items INNER JOIN wishlist_items ON items.id = wishlist_items.item_id WHERE (wishlist_items.wishlist_id = @w_id)">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView4" Name="w_id" 
                PropertyName="SelectedValue"   />
        </SelectParameters>
    </asp:SqlDataSource>
<asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="wishlist_id" DataSourceID="SqlDataSource1" Font-Names="Verdana" 
        onrowdatabound="GridView4_RowDataBound" AllowPaging="True" 
        onload="GridView4_Load" onrowcreated="GridView4_RowCreated" PageSize="1" 
        SelectedIndex="0" onselectedindexchanged="GridView4_SelectedIndexChanged">
    <Columns>
        <asp:TemplateField HeaderText="created" SortExpression="created">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("created") %>'></asp:TextBox>
            </EditItemTemplate>
            
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("created") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="wishlistname" HeaderText="wishlistname" 
            SortExpression="wishlistname" >
        <ItemStyle Font-Names="Verdana" />
        </asp:BoundField>
        <asp:BoundField DataField="cat_name" HeaderText="cat_name" 
            SortExpression="cat_name" >
        <ItemStyle Font-Names="Verdana" />
        </asp:BoundField>
        <asp:CommandField ShowSelectButton="True" >
        <ItemStyle Font-Names="Verdana" />
        </asp:CommandField>
        <asp:HyperLinkField DataNavigateUrlFields="wishlist_id" 
            DataNavigateUrlFormatString="~/whishlist.aspx?wlid={0}" Text="Add Items" />
    </Columns>
     <selectedrowstyle backcolor="LightCyan"
         forecolor="DarkBlue"
         font-bold="true"/>  
</asp:GridView>
    <br />
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
                        DataKeyNames="id" DataSourceID="SqlDataSource2" CellPadding="4" 
                        ForeColor="#333333" GridLines="None">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="title" HeaderText="title" 
                                SortExpression="titile" />
                            <asp:BoundField DataField="price" HeaderText="price" SortExpression="price" />
                        </Columns>
                        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                        <SortedAscendingCellStyle BackColor="#FDF5AC" />
                        <SortedAscendingHeaderStyle BackColor="#4D0000" />
                        <SortedDescendingCellStyle BackColor="#FCF6C0" />
                        <SortedDescendingHeaderStyle BackColor="#820000" />
                    </asp:GridView>
<br />
                <br />
</asp:Content>
